package com.local.videoplayer.dialogs;

import android.view.View;
import android.view.WindowManager;
import com.local.videoplayer.R;

/**
 * Created by ccx on 17/8/11.
 */

public class AppRateDialog extends BaseDialogFragment {

    public void setRateListener(RateListener mRateListener) {
        this.mRateListener = mRateListener;
    }

    public RateListener mRateListener;

   public interface RateListener {

        void onRate();

        void onCancel();
    }

    @Override
    public int getLayoutId() {
        return R.layout.dialog_rate;
    }

    @Override
    public void initView(View view) {
        view.findViewById(R.id.tv_rate).setOnClickListener(this);
        view.findViewById(R.id.tv_cancel).setOnClickListener(this);
    }

    @Override
    public void initLayoutParams(WindowManager.LayoutParams wlp) {

    }

    @Override
    public void onClick(View v) {
        super.onClick(v);
        dismiss();
        if (mRateListener != null) {
            switch (v.getId()) {
                case R.id.tv_rate:
                    mRateListener.onRate();
                    break;
                case R.id.tv_cancel:
                    mRateListener.onCancel();
                    break;
            }
        }
    }
}